Skip to content

Add Delta Lake 4.0 support and consolidate common code across delta-33x and delta-40x - #13570

Closed
nartal1 wants to merge 15 commits into
NVIDIA:branch-25.12from
nartal1:delta_lake_400_support
Closed

Add Delta Lake 4.0 support and consolidate common code across delta-33x and delta-40x#13570
nartal1 wants to merge 15 commits into
NVIDIA:branch-25.12from
nartal1:delta_lake_400_support

Conversation

@nartal1

@nartal1 nartal1 commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

Fixes #13339.

Description

This PR adds GPU acceleration support for Delta Lake 4.0.x and consolidates common code between Delta 3.3.x and 4.0.x implementations. By extracting shared logic into base classes and using a shims pattern for version-specific APIs, we reduce code duplication while maintaining compatibility across both Delta versions.

Key Changes

1. Delta Lake 4.0.x Support

  • New Module: Added delta-40x module with full Delta Lake 4.0 compatibility
  • Spark 4.0 APIs: Adapted to Spark 4.0's new session hierarchy (SqlSparkSession, ClassicSparkSession)
  • Expression Handling: Added support for Spark 4.0's RuntimeReplaceable expressions in statistics collection

2. Code Consolidation Strategy

Shared Base Classes (delta-lake/common/src/main/delta-33x-40x/scala/)

Command Base Classes:

  • GpuDeleteCommandBase - Consolidates DELETE command logic
  • GpuUpdateCommandBase - Consolidates UPDATE command logic
  • GpuCreateDeltaTableCommandBase - Unifies table creation flow for table operations
  • GpuOptimizeTableCommand - Common OPTIMIZE command implementation

Catalog & Data Source:

  • GpuDeltaCatalogBase - Shared catalog plugin implementation for creating/managing Delta tables
  • DeltaProviderBase - Common Delta data source provider logic
  • GpuDeltaParquetFileFormatCommon - Unified Parquet format handling with deletion vectors, column mapping, and predicate pushdown

GPU Overrides Metadata:

  • DeleteCommandMetaBase, UpdateCommandMetaBase - Shared metadata for command GPU fallback rules
  • MergeIntoCommandMetaBase, OptimizeTableCommandMetaBase - Consolidates override metadata logic
  • RapidsRowIndexFiltersBase - Common utilities for deletion vector row index filtering

Version Abstraction Layer:

  • DeltaCommandShims - Trait abstracting Spark API differences (session types, DataFrame/Column creation, caching)
  • DeltaRuntimeShimBase - Runtime utilities for Delta-specific operations
  • GpuDeltaFileFormatWriterCommon - Shared file writing infrastructure
  • MetadataShims - Metadata conversion and compatibility utilities

Version-Specific Implementations

Delta 3.3.x (Delta33xCommandShims):

  • Uses standard SparkSession throughout
  • Dataset.ofRows() for DataFrame creation
  • Direct new Column(expr) for expression wrapping

Delta 4.0.x (Delta40xCommandShims):

  • Uses SqlSparkSession for run() methods, ClassicSparkSession for operations
  • TrampolineConnectShims.createDataFrame() for Classic/Connect compatibility
  • DFUDFShims.exprToColumn() for Column creation
  • RuntimeReplaceable expression unwrapping for stats collection

3. What Remains Version-Specific

The following components have too many version-specific differences to consolidate. We can try to consolidate these files in follow-on PR's:

  • GpuOptimisticTransaction - Complex transaction logic with version-specific stats/write paths
  • GpuMergeIntoCommand - Scattered Spark API differences throughout the file
  • GpuDeltaFileFormatWriter - Version-specific write implementations

4. Testing

  • Spark 3.56 (Scala 2.12, Delta 3.3.x): Full build and verification passing
  • Spark 4.00 (Scala 2.13, Delta 4.0.x): Full build and verification passing
  • Integration tests updated for Delta 4.0 compatibility. We have disabled ANSI mode in some of the tests. The test was throwing ARITHMETIC_OVERFLOW, CAST errors for the computation. These are already tested in arithmetic_ops.py tests. So disabling ANSI mode in delta tests should be fine.
    Verified that delta all delta integration tests pass on : Delta-3.3.0 (Spark-3.5.6) and Delta-4.0.0(Spark-4.0.0)

Benchmark Run results:

No major regression between Delta-330 and Delta-400.

Delta and Spark Version Suite Platform Run on GPU Runs Total Queries Avg Runtime (s) Median Runtime (s) Min Runtime (s) Max Runtime (s) Total Runtime (s)
Delta-3.3.0, Spark-3.5.5 nds On-Prem GPU NVIDIA A100 3 381 498.413 499.322 492.058 503.86 1495.24
Delta-4.0.0, Spark-4.0.0 nds On-Prem GPU NVIDIA A100 3 381 478.481 470.413 470.293 494.736 1435.44
Delta-4.0.0, Spark-4.0.0 nds On-Prem CPU N/A 3 381 1365.619 1361.958 1360.977 1373.923 4096.86

Checklists

  • This PR has added documentation for new or modified features or behaviors.
  • This PR has added new tests or modified existing tests to cover new code paths.
    (Please explain in the PR description how the new code paths are tested, such as names of the new/existing tests that cover them.)
  • Performance testing has been performed and its results are added in the PR description. Or, an issue has been filed with a link in the PR description.

refactor common code between 330 and 400

Signed-off-by: Niranjan Artal <nartal@nvidia.com>
@nartal1 nartal1 self-assigned this Oct 3, 2025
@nartal1
nartal1 requested a review from a team as a code owner October 3, 2025 05:19
@nartal1 nartal1 added the feature request New feature or request label Oct 3, 2025
@nartal1
nartal1 marked this pull request as draft October 3, 2025 05:19
Signed-off-by: Niranjan Artal <nartal@nvidia.com>
@nartal1

nartal1 commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

build

@nartal1

nartal1 commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

build

@nartal1

nartal1 commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator Author

build

@nartal1

nartal1 commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator Author

I ran the NDS benchmark and the results are posted in the description. No regression between 330 and 400.
There is some more scope to refactor the code between 330 and 400. So keeping the PR in draft.

@nartal1

nartal1 commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator Author

build

@nartal1
nartal1 marked this pull request as ready for review October 9, 2025 20:57
@razajafri

Copy link
Copy Markdown
Collaborator

Change the description of the PR because it's not in draft anymore.

@nartal1
nartal1 marked this pull request as draft October 15, 2025 03:01
@nartal1

nartal1 commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator Author

Moving this PR back to draft. Evaluating if this can be broken into smaller PR's to make the reviews easier.

@nartal1

nartal1 commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator Author

Will be breaking up this large PR into smaller ones for making it easier to review. Closing this.

@nartal1 nartal1 closed this Oct 15, 2025
nartal1 added a commit that referenced this pull request Oct 17, 2025
Contributes to #13339

### Description
This is the first PR to add delta-4.0 support. This is to make the
review easier than going over the big PR -
#13570. There will be
subsequent PR's to add delta-lake-4.0 support and
consolidation of common code between delta-330 and delta-400.
In this PR, 
- Added delta-40x module with basic directory structure
- Added pom.xml for delta-40x module
- Added stub DeltaProbeImpl that returns NoDeltaProvider
- Updated root pom.xml and scala2.13/pom.xml to include delta-40x for
buildver=400
- Added delta40x.version property (4.0.0)

This PR creates the skeleton for Delta Lake 4.0.x support. The module
compiles but does not provide actual Delta functionality yet (returns
NoDeltaProvider).


## Testing
Built successuly without compile errors:
Delta 3.3.0 (Scala 2.12, Spark 3.5.6)
Delta 4.0.0 (Scala 2.13, Spark 4.0.0)

### Checklists
- [ ] This PR has added documentation for new or modified features or
behaviors.
- [ ] This PR has added new tests or modified existing tests to cover
new code paths.
(Please explain in the PR description how the new code paths are tested,
such as names of the new/existing tests that cover them.)
- [ ] Performance testing has been performed and its results are added
in the PR description. Or, an issue has been filed with a link in the PR
description.

---------

Signed-off-by: Niranjan Artal <nartal@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] Support Delta Lake 4.0.0

2 participants